|
OpenStack Mitaka : Use Cinder Storage (Multi-BackEnds)
2016/05/10 |
|
It's possible to use Virtual Storages provided by Cinder if an Instance needs more disks.
Configure Virtual storage with NFS and GlusterFS Multi-Backend on here.
+------------------+ +------------------+
10.0.0.50| [ Storage Node ] | 10.0.0.61| |
+------------------+ +-----+ Cinder-Volume | +-----+ GlusterFS #1 |
| [ Control Node ] | | eth0| | | eth0| |
| Keystone |10.0.0.30 | +------------------+ | +------------------+
| Glance |------------+------------------------------+
| Nova API |eth0 | +------------------+ | +------------------+
| Cinder API | | eth0| [ Compute Node ] | | eth0| |
+------------------+ +-----+ Nova Compute | +-----+ GlusterFS #2 |
10.0.0.51| | 10.0.0.62| |
+------------------+ | +------------------+
|
| +------------------+
| eth0| |
+-----+ NFS |
10.0.0.40| |
+------------------+
|
| [1] |
NFS server is required to be running on your LAN, refer to here.
On this example, configure "/storage" directory on "nfs.srv.world" as a shared directory. |
| [2] |
GlusterFS server is required to be running on your LAN, refer to here.
This example uses a replication volume "vol_replica" provided by "glfs01" and "glfs02". |
| [3] | Configure Storage Node. |
|
# install from EPEL
[root@storage ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@storage ~]#
vi /etc/cinder/cinder.conf # add follows in the [DEFAULT] section enabled_backends=nfs,glusterfs # add follows to the end
[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver volume_backend_name = NFS nfs_shares_config = /etc/cinder/nfs_shares nfs_mount_point_base = $state_path/mnt_nfs
[glusterfs]
volume_driver = cinder.volume.drivers.glusterfs.GlusterfsDriver volume_backend_name = GlusterFS glusterfs_shares_config = /etc/cinder/glusterfs_shares glusterfs_mount_point_base = $state_path/mnt_glusterfs
[root@storage ~]#
vi /etc/cinder/nfs_shares # create new : specify NFS shared directories nfs.srv.world:/storage
[root@storage ~]#
vi /etc/cinder/glusterfs_shares # create new : specify GlusterFS volumes glfs01.srv.world:/vol_replica chmod 640 /etc/cinder/nfs_shares [root@storage ~]# chgrp cinder /etc/cinder/nfs_shares [root@storage ~]# chmod 640 /etc/cinder/glusterfs_shares [root@storage ~]# chgrp cinder /etc/cinder/glusterfs_shares [root@storage ~]# systemctl restart openstack-cinder-volume [root@storage ~]# chown -R cinder. /var/lib/cinder/mnt_nfs |
| [4] | Configure Compute Node to mount NFS and GlusterFS volumes. |
|
# install from EPEL
[root@node01 ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@node01 ~]#
vi /etc/nova/nova.conf # add follows in the [DEFAULT] section volume_api_class = nova.volume.cinder.API systemctl restart openstack-nova-compute |
| [5] | Create volume types. It's OK to work on any node. (This example is on Control Node) |
|
# set environment variable first [root@dlp ~(keystone)]# echo "export OS_VOLUME_API_VERSION=2" >> ~/keystonerc [root@dlp ~(keystone)]# source ~/keystonerc
cinder type-create nfs +--------------------------------------+------+-------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+------+-------------+-----------+ | 3a387d34-973d-4dde-b4d4-2f1052080dea | nfs | - | True | +--------------------------------------+------+-------------+-----------+[root@dlp ~(keystone)]# cinder type-create glusterfs +--------------------------------------+-----------+-------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+-----------+-------------+-----------+ | 2ec412a2-11f9-4ee9-bcf7-386019fc8b22 | glusterfs | - | True | +--------------------------------------+-----------+-------------+-----------+[root@dlp ~(keystone)]# cinder type-list +--------------------------------------+-----------+-------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+-----------+-------------+-----------+ | 2ec412a2-11f9-4ee9-bcf7-386019fc8b22 | glusterfs | - | True | | 3a387d34-973d-4dde-b4d4-2f1052080dea | nfs | - | True | +--------------------------------------+-----------+-------------+-----------+ |
| [6] | Associates volume types set in [5] and names set in cinder.conf. |
|
[root@dlp ~(keystone)]# cinder type-key nfs set volume_backend_name=NFS [root@dlp ~(keystone)]# cinder type-key glusterfs set volume_backend_name=GlusterFS [root@dlp ~(keystone)]# cinder extra-specs-list
+--------------------------------------+-----------+--------------------------------------+
| ID | Name | extra_specs |
+--------------------------------------+-----------+--------------------------------------+
| 2ec412a2-11f9-4ee9-bcf7-386019fc8b22 | glusterfs | {'volume_backend_name': 'GlusterFS'} |
| 3a387d34-973d-4dde-b4d4-2f1052080dea | nfs | {'volume_backend_name': 'NFS'} |
+--------------------------------------+-----------+--------------------------------------+
|
| [7] | Create volumes with specifying volume types. |
|
[root@dlp ~(keystone)]# cinder create --display_name disk_nfs --volume-type nfs 10
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-05-10T12:36:15.000000 |
| description | None |
| encrypted | False |
| id | 3365c5e9-14ee-4606-adbf-386580befd63 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | disk_nfs |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 7a160aeddebd4e398fd22e6491f10baa |
| replication_status | disabled |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | f9c0838d5fcf4a87ba2e0b1653faa6d0 |
| volume_type | nfs |
+--------------------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder create --display_name disk_glusterfs --volume-type glusterfs 10
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-05-10T12:36:34.000000 |
| description | None |
| encrypted | False |
| id | a01e06f7-17a5-4a76-966e-db5f5cf53a8b |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | disk_glusterfs |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 7a160aeddebd4e398fd22e6491f10baa |
| replication_status | disabled |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | f9c0838d5fcf4a87ba2e0b1653faa6d0 |
| volume_type | glusterfs |
+--------------------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder list +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | 3365c5e9-14ee-4606-adbf-386580befd63 | available | disk_nfs | 10 | nfs | false | | | a01e06f7-17a5-4a76-966e-db5f5cf53a8b | available | disk_glusterfs | 10 | glusterfs | false | | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ |
| [8] | The Configuration is all OK. Attach volumes to instances like follows. |
|
[root@dlp ~(keystone)]# nova list +-----------+----------+---------+------------+-------------+-----------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+----------+---------+------------+-------------+-----------------------------------+ | 4e232450- | CentOS_7 | SHUTOFF | - | Shutdown | int_net=192.168.100.3, 10.0.0.201 | +-----------+----------+---------+------------+-------------+-----------------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_7 3365c5e9-14ee-4606-adbf-386580befd63 auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | id | 3365c5e9-14ee-4606-adbf-386580befd63 | | serverId | 4e232450-4cae-47ba-a19a-1c59e3cbc91b | | volumeId | 3365c5e9-14ee-4606-adbf-386580befd63 | +----------+--------------------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_7 a01e06f7-17a5-4a76-966e-db5f5cf53a8b auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdc | | id | a01e06f7-17a5-4a76-966e-db5f5cf53a8b | | serverId | 4e232450-4cae-47ba-a19a-1c59e3cbc91b | | volumeId | a01e06f7-17a5-4a76-966e-db5f5cf53a8b | +----------+--------------------------------------+ # the status of attached disk turns "in-use" like follows [root@dlp ~(keystone)]# cinder list +--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+ | 3365c5e9-14ee-4606-adbf-386580befd63 | in-use | disk_nfs | 10 | nfs | false | 4e232450-4cae-47ba-a19a-1c59e3cbc91b | | a01e06f7-17a5-4a76-966e-db5f5cf53a8b | in-use | disk_glusterfs | 10 | glusterfs | false | 4e232450-4cae-47ba-a19a-1c59e3cbc91b | +--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+ |